package com.gcs.k8s01.controller;

import com.gcs.k8s01.aspect.SysLog;
import com.gcs.k8s01.dao.EmployeeDao;
import com.gcs.k8s01.dao.UserInfoDao;
import com.gcs.k8s01.entity.EmployeeInfo;
import com.gcs.k8s01.entity.UserInfoEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.data.domain.Example;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description TODO
 * @Author guosong
 * @Date 2023/11/17 8:43
 */
@RestController
@Api(tags = "员工管理")
public class EmployeeController {
    @Resource
    private EmployeeDao employeeDao;
    @PostMapping("addEmp")
    @SysLog(desc = "添加员工",reqData ="#employeeInfo")
    @ApiOperation("添加员工")
    public EmployeeInfo addEmp(EmployeeInfo employeeInfo){
        return  employeeDao.save(employeeInfo);
    }



    @GetMapping("listEmp")
    @ApiOperation("查找员工")
    @SysLog(desc = "查找员工",reqData ="#userInfoEntity")
    public List<EmployeeInfo> listEmp( EmployeeInfo employeeInfo){
        return employeeDao.findAll(Example.of(employeeInfo));
    }
}
